//
//  DkUnathorizedMainCenterView.m
//  DanKU
//
//  Created by 吴斌 on 2023/10/24.
//

#import "DkUnathorizedMainCenterView.h"
#import "DKUnathorizedSigleCenterView.h"
@interface DkUnathorizedMainCenterView()
@property (nonatomic, strong)DKUnathorizedSigleCenterView * dkUnathorizedSigleCenterLimitView;
@property (nonatomic, strong)DKUnathorizedSigleCenterView * dkUnathorizedSigleCenterPaymentView;
@end
@implementation DkUnathorizedMainCenterView
-(instancetype)init{
    if(self == [super init]){
        self.backgroundColor = UIColor.clearColor;
        [self dk_addSubView];
        [self makeUserInfo];
    }
    return self;
}
- (void)dk_addSubView{
    WeakSelf(self)
    self.dkUnathorizedSigleCenterLimitView = [[DKUnathorizedSigleCenterView alloc] init];
    self.dkUnathorizedSigleCenterLimitView.isLeft = YES;
    [self addSubview:self.dkUnathorizedSigleCenterLimitView];
    [self.dkUnathorizedSigleCenterLimitView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(15)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.bottom.equalTo(@(-DK_IsWidthScale(13)));
    }];
    self.dkUnathorizedSigleCenterLimitView.CheckUserInfoBlock = ^(NSString * _Nonnull value) {
        if(weakSelf.CheckUserInfoBlock){
            weakSelf.CheckUserInfoBlock(value, YES);
        }
    };
    
    self.dkUnathorizedSigleCenterPaymentView = [[DKUnathorizedSigleCenterView alloc] init];
    self.dkUnathorizedSigleCenterPaymentView.isLeft = NO;
    [self addSubview:self.dkUnathorizedSigleCenterPaymentView];
    [self.dkUnathorizedSigleCenterPaymentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.dkUnathorizedSigleCenterLimitView.mas_right).offset(DK_IsWidthScale(9));
        make.right.equalTo(@(-DK_IsWidthScale(15)));
        make.top.equalTo(@(DK_IsWidthScale(0)));
        make.bottom.equalTo(@(-DK_IsWidthScale(13)));
        make.width.equalTo(self.dkUnathorizedSigleCenterLimitView);
    }];
    self.dkUnathorizedSigleCenterPaymentView.CheckUserInfoBlock = ^(NSString * _Nonnull value) {
        if(weakSelf.CheckUserInfoBlock){
            weakSelf.CheckUserInfoBlock(value, NO);
        }
    };
}
- (void)makeUserInfo{
    DKUserBaseInfoModel * userBaseInfoMdl = [DKGlobalHelper defaultManager].userBaseInfoMdl;
    DKUserComplaintModel * userComplaintMdl = [DKGlobalHelper defaultManager].userComplaintMdl;
    
    self.dkUnathorizedSigleCenterLimitView.value = userComplaintMdl.unused;
    self.dkUnathorizedSigleCenterPaymentView.value =  userBaseInfoMdl.repaymentRemainAmount;
}
-(void)setDk_OrderListMdl:(DKOrderListModel *)dk_OrderListMdl{
    _dk_OrderListMdl = dk_OrderListMdl;
    self.dkUnathorizedSigleCenterPaymentView.dk_OrderListMdl = _dk_OrderListMdl;
}
@end
